finding the least common denominator